package Thread.CAS;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicTest {
    class Counter{
        //基于整型的原子类
        AtomicInteger count=new AtomicInteger();
    }

    public static void main(String[] args) {
        AtomicInteger count=new AtomicInteger();
        //等同于 ++i
        System.out.println(count.incrementAndGet());
        //等同于 i++
        System.out.println(count.getAndIncrement());
        //等同于 --i
        System.out.println(count.decrementAndGet());
        //等同于 i--
        System.out.println(count.getAndDecrement());
    }
}
